<?php
/**
* @package Scribble
* @subpackage Plugin
*/
Buan\View::getGlobalView()->addJavascripts(Buan\Config::get('ext.Scribble.plugin.SpTemplateEditor.urlRoot').'/js/common.js');
?>
<div class="head">
	<h1>Template Editor</h1>
	<h2>Create A Template</h2>
</div>

<div class="std">
	<form method="post">
		<?php if(count($templatePaths)>1): ?>
			<dl>
				<dt>Select the template path in which you want to store this template</dt>
				<dd>
					<select name="templatePath">
					<?php foreach($templatePaths as $k=>$tp): ?>
						<option value="<?php echo $k; ?>"<?php echo $template->templatePathIndex==$k ? ' selected="selected"' : ''; ?>><?php $this->html->e($tp->url); ?></option>
					<?php endforeach; ?>
					</select>
				</dd>
			</dl>
		<?php endif; ?>

		<dl class="required">
			<dt>Which type of template do you want to create?</dt>
			<dd>
				<label><input type="radio" name="type" value="inner"<?php echo $template->type=='inner' ? 'checked="checked"' : ''; ?> /> Inner</label><br/>
				<label><input type="radio" name="type" value="outer"<?php echo $template->type=='outer' ? 'checked="checked"' : ''; ?> /> Outer</label>
			</dd>
		</dl>

		<dl>
			<dt>Which rendering language would you prefer to use for generating the markup?</dt>
			<dd>
				<select name="renderEngine">
				<?php foreach($renderEngines as $re): ?>
					<option value="<?php echo $re['name']; ?>"<?php echo $template->renderEngine==$re['name'] ? ' selected="selected"' : ''; ?>><?php $this->html->e($re['label']); ?></option>
				<?php endforeach; ?>
				</select>
			</dd>
		</dl>

		<dl class="required">
			<dt>Template name</dt>
			<dt class="aid">All your template assets will be stored in a folder with this name. Use the <strong>lower-hyphenated</strong> format.</dt>
			<dd>
				<input class="medium" type="text" name="name" value="<?php $this->html->e($template->name); ?>" />
			</dd>
		</dl>

		<dl class="required">
			<dt>Title</dt>
			<dt class="aid">Your template will be known by this title</dt>
			<dd>
				<input class="medium" type="text" name="title" value="<?php $this->html->e($template->title); ?>" />
			</dd>
		</dl>

		<dl>
			<dt>Short description</dt>
			<dd>
				<input class="large" type="text" name="shortdesc" value="<?php $this->html->e($template->shortdesc); ?>" />
			</dd>
		</dl>

		<dl>
			<dt>Long description</dt>
			<dt class="aid">Describe how to use your template</dt>
			<dd>
				<textarea rel="scribble-widget" scribblewidget:type="rte" scribblewidget:config="rteTemplateLongDesc" name="longdesc"><?php $this->html->e($template->longdesc); ?></textarea>
			</dd>
		</dl>

		<p>
			<button class="submit" type="submit">Generate</button>
		</p>
	</form>
</div>